package com.sx.art2.tools;

public class Page {  
	    private int pageNow = 1; // 当前页数  
	  
	    private int pageSize = 4; // 每页显示记录的条数  
	  
	    private int totalCount; // 总的记录条数  
	  
	    private int totalPageCount; // 总的页数  
	    
	    private int startRow=0;

		public Page() {
			super();
			// TODO 自动生成的构造函数存根
		}


		public Page(int pageNow, int pageSize, int totalCount, int totalPageCount, int startRow) {
			super();
			this.pageNow = pageNow;
			this.pageSize = pageSize;
			this.totalCount = totalCount;
			this.totalPageCount = totalPageCount;
			this.startRow = startRow;
		}


		public int getPageNow() {
			return pageNow;
		}

		public void setPageNow(int pageNow) {
			this.pageNow = pageNow;
		}

		public int getPageSize() {
			return pageSize;
		}

		public void setPageSize(int pageSize) {
			this.pageSize = pageSize;
		}

		public int getTotalCount() {
			return totalCount;
		}

		public void setTotalCount(int totalCount) {
			this.totalCount = totalCount;
		}

		public int getTotalPageCount() {			
			return totalCount%pageSize==0?totalCount/pageSize:totalCount/pageSize+1;
		}

		public void setTotalPageCount(int totalPageCount) {
			this.totalPageCount = totalPageCount;
		}


		public int getStartRow() {
			return pageNow<=1?0:(pageNow-1)*pageSize;
		}


		public void setStartRow(int startRow) {
			this.startRow = startRow;
		}


		@Override
		public String toString() {
			return "Page [pageNow=" + pageNow + ", pageSize=" + pageSize + ", totalCount=" + totalCount
					+ ", totalPageCount=" + totalPageCount + ", startRow=" + startRow + "]";
		}
	      
	    /** 
	     * 通过构造函数 传入  总记录数  和  当前页 
	     * @param totalCount 
	     * @param pageNow 
	     */
}
